/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * http://www.gnu.org/copyleft/gpl.html
 */
package net.l1j.server.model.monitor;

import net.l1j.server.model.L1World;
import net.l1j.server.model.instance.L1PcInstance;

/**
 * L1PcInstance�U�w���B�z�B�ʵ�B�z���y���쬰�U�@�q���Q�B�z�y������F�⹳ǫ��ǵ
 * 
 * �Uǻǵǫ�B�z�V{@link #run()}�N�V�Q��{@link #execTask(L1PcInstance)}�R�M����@�r�C
 * PC����Ǭ�|Ǣ���@�r�Q�P���MǱ���̤W�R�s�b���Q���Q�J�F���X�Brun()��ǹǿ���N�V�Y�y�R��ǻ�����@�r�C
 * �D�U���X�Bǻǵǫ��w�����ǵǭǴ��������Ǭ���s�M���F�p�B��Ǭ�|Ǣ�ĳB�z���NǵǭǴ��������Ǭ�y�����@�r���n�����r�C
 * �������Q���s�Wǻǵǫ�V���e�p�A�B�û��R�w��������s�r���O�R�Q�r�C
 * �w������N�Q����o�|ǫǳ�����U���X�V�D�U�o���Q��s�V���n�C
 * 
 * L1PcInstance�U�ѷ��y�������K���O�V���e�����Q��C
 * 
 * @author frefre
 *
 */
public abstract class L1PcMonitor implements Runnable {

	/** ����ǻ��ﹳL1PcInstance�UǦ��Ǵǣǫ��ID */
	protected int _id;

	/**
	 * ��w���s�F��������ǻ�NL1PcInstance�R���@�r����ǻ���y�@���@�r�C
	 * @param oId {@link L1PcInstance#getId()}�N��o�N���rǦ��Ǵǣǫ��ID
	 */
	public L1PcMonitor(int oId) {
		_id = oId;
	}

	//////////////@Override
	public final void run() {
		L1PcInstance pc = (L1PcInstance) L1World.getInstance().findObject(_id);
		if (pc == null || pc.getNetConnection() == null) {
			return;
		}
		execTask(pc);
	}

	/**
	 * ǻǵǫ�����U�B�z
	 * @param pc ����ǻ��ﹳ�UPC
	 */
	public abstract void execTask(L1PcInstance pc);
}
